<?php

class DesignTimeWorkflowParallelSplitWithForeachableNode extends DesignTimeWorkflowParallelSplitNode
{
  
  /**
   * @var mixed
   */
  protected $foreachable;

  /**
   * @param string $identifier
   * @param mixed $foreachable
   */
  public function __construct ($identifier, $foreachable)
  {
    $this->foreachable = $foreachable;
    parent::__construct($identifier);
  }

  /**
   * @return mixed
   */
  public function getForeachable ()
  {
    return $this->foreachable;
  }

  /**
   * Dynamic number of out nodes
   * @return integer
   */
  public function getMinOutNodes ()
  {
    return count($this->foreachable);
  }

  /**
   * Dynamic number of out nodes
   * @return integer
   */
  public function getMaxOutNodes ()
  {
    return count($this->foreachable);
  }

  /**
   * @param RunTimeWorkflow $workflow
   * @return AbstractRunTimeWorkflowNode
   */
  public function createRunTimeNode (RunTimeWorkflow $workflow)
  {
    return new RunTimeWorkflowParallelSplitWithForeachableNode($workflow, $this);
  }
}